<template>
  <div class="add-customer">
    <el-form :model="customerForm" label-width="120px">
      <h3>基础信息</h3>
      <el-row :gutter="20">
        <el-col :span="8">
          <el-form-item label="客户编码">
            <el-input v-model="customerForm.code" placeholder="请输入内容"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="客户名称">
            <el-input v-model="customerForm.name" placeholder="请输入内容"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="所属行业">
            <el-select v-model="customerForm.industry" placeholder="请选择">
              <!-- 添加行业选项 -->
            </el-select>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :span="8">
          <el-form-item label="客户级别">
            <el-select v-model="customerForm.level" placeholder="请选择">
              <!-- 添加客户级别选项 -->
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="客户标签">
            <el-select v-model="customerForm.tags" placeholder="请选择">
              <!-- 添加客户标签选项 -->
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="区域">
            <el-select v-model="customerForm.region" placeholder="请选择">
              <!-- 添加区域选项 -->
            </el-select>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :span="8">
          <el-form-item label="邮编">
            <el-input v-model="customerForm.postcode" placeholder="请输入内容"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="16">
          <el-form-item label="公司地址">
            <el-input v-model="customerForm.address" placeholder="请输入内容"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :span="8">
          <el-form-item label="备注信息">
            <el-input v-model="customerForm.remarks" placeholder="请输入内容"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="16">
          <el-form-item label="客户状态">
            <el-switch v-model="customerForm.status" active-text="启用" inactive-text="禁用"></el-switch>
          </el-form-item>
        </el-col>
      </el-row>

      <h3>联系人信息</h3>
      <el-row :gutter="20">
        <el-col :span="8">
          <el-form-item label="姓名">
            <el-input v-model="customerForm.contactName" placeholder="请输入内容"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="手机号码">
            <el-input v-model="customerForm.contactPhone" placeholder="请输入内容"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="部门">
            <el-input v-model="customerForm.contactDepartment" placeholder="请输入内容"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :span="8">
          <el-form-item label="职位">
            <el-input v-model="customerForm.contactPosition" placeholder="请输入内容"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="E-mail">
            <el-input v-model="customerForm.contactEmail" placeholder="请输入内容"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="QQ">
            <el-input v-model="customerForm.contactQQ" placeholder="请输入内容"></el-input>
          </el-form-item>
        </el-col>
      </el-row>

      <h3>财务信息</h3>
      <el-row :gutter="20">
        <el-col :span="8">
          <el-form-item label="发票抬头">
            <el-input v-model="customerForm.invoiceTitle" placeholder="请输入内容"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="纳税人识别号">
            <el-input v-model="customerForm.taxId" placeholder="请输入内容"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="开户行">
            <el-input v-model="customerForm.bankName" placeholder="请输入内容"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :span="8">
          <el-form-item label="开户名称">
            <el-input v-model="customerForm.bankAccountName" placeholder="请输入内容"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="银行账号">
            <el-input v-model="customerForm.bankAccountNumber" placeholder="请输入内容"></el-input>
          </el-form-item>
        </el-col>
      </el-row>

      <el-form-item>
        <el-button type="primary" @click="submitForm">保存</el-button>
        <el-button @click="cancelForm">取消</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
export default {
  name: 'AddCustomer',
  data() {
    return {
      customerForm: {
        // 基础信息
        code: '',
        name: '',
        industry: '',
        level: '',
        tags: '',
        region: '',
        postcode: '',
        address: '',
        remarks: '',
        status: true,
        // 联系人信息
        contactName: '',
        contactPhone: '',
        contactDepartment: '',
        contactPosition: '',
        contactEmail: '',
        contactQQ: '',
        // 财务信息
        invoiceTitle: '',
        taxId: '',
        bankName: '',
        bankAccountName: '',
        bankAccountNumber: '',
      }
    }
  },
  methods: {
    submitForm() {
      // 实现表单提交逻辑
      console.log('Form submitted:', this.customerForm);
    },
    cancelForm() {
      // 实现取消操作
      this.$router.push('/customers'); // 假设有一个客户列表路由
    }
  }
}
</script>

<style scoped>
.add-customer {
  padding: 20px;
}
h3 {
  margin-top: 20px;
  margin-bottom: 20px;
}
</style>
